package com.itheima.tlias.mapper;

import com.github.pagehelper.Page;
import com.itheima.tlias.dto.CheckClazzDto;
import com.itheima.tlias.entity.Clazz;
import com.itheima.tlias.vo.ClazzListVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClazzMapper {

    Page<ClazzListVo> clazzPage(CheckClazzDto clazz);

    @Insert("insert into clazz (name,room,begin_date,end_date,master_id,subject,create_time,update_time) " +
            "values (#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void addClazz(Clazz clazz);

    @Delete("delete from clazz where id=#{id}")
    void deleteClazz(Integer id);

    @Select("select * from clazz where id=#{id}")
    Clazz getById(Integer id);

    void updateClazz(Clazz dto);

    @Select("select * from clazz")
    List<Clazz> students();
}
